package com.ruijixiang.leetcode.everyday.leetcode2024.leetcode202410;

public class leetcode20241020 {
    public int smallestRangeI(int[] nums,int k){
        int max=nums[0],min=nums[0];
        for(int num : nums){
            max=Math.max(num,max);
            min=Math.min(num,min);
        }
        if(max-min>2*k){
            return max-min-2*k;
        }else{
            return 0;
        }
    }
}
